@extends('admin.app')

@section('breadcrumb')
<div class="bg-light lter b-b wrapper-md">
  <ol class="breadcrumb bg-light lter m-n no-padder">
    <li><a href="{{ admin_action('HomeController@index') }}">主页</a></li>
    <li>Rbac</li>
    <li class="active">系统管理员管理</li>
  </ol>
</div>
@endsection

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      管理员信息列表
    </div>
    <div class="row wrapper">
      <div class="col-sm-4">
        <form action="{{ admin_action('Rbac\UsersController@index') }}">
          <div class="input-group">
            <input type="text" class="input-sm form-control" name="search" value="{{ $query['search'] ?? '' }}" placeholder="请输入查询条件">
            <span class="input-group-btn">
              <button class="btn btn-sm btn-default" type="submit">查询</button>
            </span>
          </div>
        </form>
      </div>
      <div class="col-sm-8 text-right text-center-xs">
        @accredit('web.navigations.create')
        <a class="btn m-b-xs btn-sm btn-default btn-addon" href="{{ admin_action('Rbac\UsersController@create') }}">
          <i class="fa fa-plus"></i>新增系统管理员
        </a>
        @endaccredit
      </div>
    </div>
    <div class="table-responsive">
      <table class="table table-striped b-t b-light">
        <thead>
          <tr>  
            <th>#</th>
            <th>用户名</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          @forelse ($users as $user)
          @if($user->username != 'admin')
          <tr>
            <td>{{ $user->id }}</td>
            <td>{{ $user->username }}</td>
            <td>
              <a class="btn btn-xs btn-primary" href="{{ admin_action('Rbac\UsersController@edit', [$user]) }}" data-toggle="tooltip" title="编辑管理员信息">
                <i class="fa fa-pencil"></i>
              </a>
              <form class="inline" action="{{ admin_action('Rbac\UsersController@destroy', [$user]) }}" method="post">
                {{ csrf_field() }}
                {{ method_field('DELETE') }}
                <button type="button" data-swal-role="delete-confirm" class="btn btn-xs btn-danger" data-toggle="tooltip" title="删除管理员信息">
                  <i class="fa fa-trash-o"></i>
                </button>
              </form>
            </td>
          </tr>
          @endif
          @empty
          <tr>
            <td colspan="3" class="text-center">没有找到管理员记录</td>
          </tr>
          @endforelse
        </tbody>
      </table>
    </div>
    <div class="panel-footer">
      <div class="row">
        <div class="col-sm-12 text-right text-center-xs">                
          {{ $links }}
        </div>
      </div>
    </div>
  </div>
@endsection